package com.leap.meeting.dao.imple;

import com.leap.meeting.dao.BaseDAO;
import com.leap.meeting.dao.RecordDAO;
import com.leap.meeting.pojo.Admin;
import com.leap.meeting.pojo.Record;
import com.leap.meeting.pojo.Room;

import java.sql.SQLException;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;

public class RecordDAOimple extends BaseDAO implements RecordDAO {
    @Override
    public List<Record> selectAll() {
        try {
            String sql = "SELECT id,room_name AS name,address,attendees,speaker,topic,training_content AS trainContent,start_time AS startTime,end_time AS endTime,express from record";
            return super.executeQuery(Record.class, sql, null);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

    @Override
    public List<Record> selectByName(String name) {
        try {
            String sql = "SELECT id,room_name AS name,address,attendees,speaker,topic,training_content AS trainContent,start_time AS startTime,end_time AS endTime,express from record where room_name = ?";
            return super.executeQuery(Record.class, sql, name);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

}
